#ifndef GPUSVM_FRAMEWORK
#define GPUSVM_FRAMEWORK

#define GPUSVM_VERSION 0.2

#define GPUSVM_BLOCKSIZE 256
#define GPUSVM_IMUL(a, b) (a * b)
#define GPUSVM_MAX_PITCH 262144
#define GPUSVM_MAX_POINTS (GPUSVM_MAX_PITCH/sizeof(float) - 2)

#define intDivideRoundUp(a, b) (a%b!=0)?(a/b+1):(a/b)


#ifdef __DEVICE_EMULATION__
#define GPUSVM_SYNC __syncthreads()
#else
#define GPUSVM_SYNC
#endif

#define GPUSVM_REDUCE0  0x00000001
#define GPUSVM_REDUCE1  0x00000002
#define GPUSVM_REDUCE2  0x00000004
#define GPUSVM_REDUCE3  0x00000008
#define GPUSVM_REDUCE4  0x00000010
#define GPUSVM_REDUCE5  0x00000020
#define GPUSVM_REDUCE6  0x00000040
#define GPUSVM_REDUCE7  0x00000080
#define GPUSVM_REDUCE8  0x00000100
#define GPUSVM_REDUCE9  0x00000200
#define GPUSVM_REDUCE10 0x00000400
#define GPUSVM_REDUCE11 0x00000800
#define GPUSVM_REDUCE12 0x00001000
#define GPUSVM_REDUCE13 0x00002000
#define GPUSVM_REDUCE14 0x00004000
#define GPUSVM_REDUCE15 0x00008000
#define GPUSVM_REDUCE16 0x00010000
#define GPUSVM_REDUCE17 0x00020000
#define GPUSVM_REDUCE18 0x00040000
#define GPUSVM_REDUCE19 0x00080000
#define GPUSVM_REDUCE20 0x00100000
#define GPUSVM_REDUCE21 0x00200000
#define GPUSVM_REDUCE22 0x00400000
#define GPUSVM_REDUCE23 0x00800000
#define GPUSVM_REDUCE24 0x01000000
#define GPUSVM_REDUCE25 0x02000000
#define GPUSVM_REDUCE26 0x04000000
#define GPUSVM_REDUCE27 0x08000000
#define GPUSVM_REDUCE28 0x10000000
#define GPUSVM_REDUCE29 0x20000000
#define GPUSVM_REDUCE30 0x40000000
#define GPUSVM_REDUCE31 0x80000000
#define GPUSVM_NOREDUCE 0x00000000
#define GPUSVM_INFTY  __int_as_float(0x7f000000)
#define GPUSVM_NINFTY __int_as_float(0xff000000)


#endif
